﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.IO;

namespace SearchAndReplace
{
    public partial class HelpButton : UserControl
    {
        [DefaultValue("")] 
        public string HelpFile { get; set; }


        public HelpButton()
        {
            InitializeComponent();

            this.HelpPicture.Location = new Point();
            this.Size = HelpPicture.Size;
        }


        private void HelpPicture_Click(object sender, EventArgs e)
        {
            using (FormHelp popup = new FormHelp())
            {
                Assembly assembly = Assembly.GetExecutingAssembly();
                TextReader reader = new StreamReader(assembly.GetManifestResourceStream("SearchAndReplace.Help." + HelpFile));
                popup.Rtf = reader.ReadToEnd();
                popup.ShowDialog();  
            }
        }


        private void HelpButton_Resize(object sender, EventArgs e)
        {
            this.Size = HelpPicture.Size;
        }
    }
}
